import request from '@/utils/request'

// 查询部门列表
export function listSubject(query) {
  return request({
    url: '/system/subject/list',
    method: 'post',
    data: query
  })
}

// 查询部门列表（排除节点）
export function listSubjectExcludeChild(subjectId) {
  return request({
    url: '/system/subject/list/exclude/' + subjectId,
    method: 'get'
  })
}

// 查询部门详细
export function getSubject(subjectId) {
  return request({
    url: '/system/subject/' + subjectId,
    method: 'get'
  })
}

// 新增部门
export function addSubject(data) {
  return request({
    url: '/system/subject',
    method: 'post',
    data: data
  })
}

// 修改部门
export function updateSubject(data) {
  return request({
    url: '/system/subject',
    method: 'put',
    data: data
  })
}

// 删除部门
export function delSubject(subjectId) {
  return request({
    url: '/system/subject/' + subjectId,
    method: 'delete'
  })
}
export function hasChild(subjectId) {
  return request({
    url: '/system/subject/hasChild/' + subjectId,
    method: 'get'
  })
}

export function updateSubjectStock(data) {
  return request({
    url: '/system/subject/updateSubjectStock',
    method: 'post',
    data: data
  })
}

export function childStockTree(subjectId) {
  return request({
    url: '/all/child-stock-tree/' + subjectId,
    method: 'get'
  })
}
